package com.example.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.entity.RolesEntity;
import com.example.entity.UserrolesEntity;
import com.example.entity.UsersEntity;
import com.example.entity.UsersVoEntity;
import com.example.mapper.UsersMapper;
import com.example.service.UsersService;


@Service
public class UsersServiceImpl implements UsersService{

	@Autowired
	private UsersMapper usersMapper;
	/**
	 * 账号密码登录
	 */
	@Override
	public UsersEntity loginAccount(String loginname,String password) {
		// TODO Auto-generated method stub
		UsersEntity users=new UsersEntity();
		users.setLoginname(loginname);
		users.setPassword(password);
		return usersMapper.loginAccount(users);
	}
	/**
	 * 多条件查询
	 */
	@Override
	public List<UsersEntity> GetUsersLayUI(UsersVoEntity usersVoEntity) {
		// TODO Auto-generated method stub
		return usersMapper.GetUsersLayUI(usersVoEntity);
	}
	/**
	 * 分页查询
	 */
	@Override
	public int getCount(UsersVoEntity usersVoEntity) {
		// TODO Auto-generated method stub
		return usersMapper.getCount(usersVoEntity);
	}
	/**
	 * 创建用户
	 */

	@Override
	public int addUser(UsersEntity usersEntity) {
		// TODO Auto-generated method stub
		return usersMapper.addUser(usersEntity);
	}
	/**
	 * 更新用户
	 */

	@Override
	public int upUser(UsersEntity usersEntity) {
		// TODO Auto-generated method stub
		return usersMapper.upUser(usersEntity);
	}
	/**
	 * 根据id删除用户
	 */

	@Override
	public int delUser(int id) {
		// TODO Auto-generated method stub
		return usersMapper.delUser(id);
	}
	/**
	 * 重置密码
	 */

	@Override
	public int ResetPassword(int id) {
		// TODO Auto-generated method stub
		return usersMapper.ResetPassword(id);
	}
	
	/**
	 * 根据id查询
	 */

	@Override
	public UsersEntity selectByPrimaryKey(String id) {
		// TODO Auto-generated method stub
		return usersMapper.selectByPrimaryKey(id);
	}
	
	/**
	 * 查询全部
	 */

	@Override
	public List<UsersEntity> selectListAll() {
		// TODO Auto-generated method stub
		return usersMapper.selectListAll();
	}
	
	/**
	 * 根据loginName和password查询
	 */

	@Override
	public UsersEntity selectByNameAndPwd(String loginname, String password) {
		// TODO Auto-generated method stub
		return usersMapper.selectByNameAndPwd(loginname, password);
	}
	
	/**
	 * 根据loginName查询
	 */

	@Override
	public UsersEntity selectByName(String loginName) {
		// TODO Auto-generated method stub
		return usersMapper.selectByName(loginName);
	}
	
	/**
	 * 根据用户id获取角色
	 */

	@Override
	public List<RolesEntity> getRolesByUid(int userid) {
		// TODO Auto-generated method stub
		return usersMapper.getRolesByUid(userid);
	}
	
	/**
	 * 查询所有角色
	 */

	@Override
	public List<RolesEntity> GetRolesAll() {
		// TODO Auto-generated method stub
		return usersMapper.GetRolesAll();
	}
	
	/**
	 * 锁定
	 */

	@Override
	public int islock(int id) {
		// TODO Auto-generated method stub
		return usersMapper.islock(id);
	}
	
	/**
	 * 解锁
	 */

	@Override
	public int noIslock(int id) {
		// TODO Auto-generated method stub
		return usersMapper.noIslock(id);
	}
	@Override
	public int addCreatetime(Integer id) {
		// TODO Auto-generated method stub
		return usersMapper.addCreatetime(id);
	}
	@Override
	public int addUR(UserrolesEntity ur) {
		// TODO Auto-generated method stub
		return usersMapper.addUR(ur);
	}
	@Override
	public int delUR(UserrolesEntity ur) {
		// TODO Auto-generated method stub
		return usersMapper.delUR(ur);
	}
	@Override
	public List<UsersEntity> getUserConsultant() {
		// TODO Auto-generated method stub
		return usersMapper.getUserConsultant();
	}
	/**
	 * 手机号登录
	 */
	@Override
	public UsersEntity selectByProtectMTel(String phoneNumber) {
		// TODO Auto-generated method stub
		return usersMapper.selectByProtectMTel(phoneNumber);
	}
	@Override
	public int getUserId(String name) {
		// TODO Auto-generated method stub
		return usersMapper.getUserId(name);
	}

	
	
}
